package lc.util;

import com.jme.math.Quaternion;
import com.jme.math.Vector3f;

public final class AxisAngle {
	public AxisAngle(Quaternion q) {
		axis = new Vector3f();
		radians = q.toAngleAxis(axis);
	}
	public AxisAngle(Vector3f axis, float radians) {
		this(axis, radians, false);
	}
	public AxisAngle(Vector3f axis, float radians, boolean isNormalized) {
		if (isNormalized)
			this.axis = axis.clone();
		else
			this.axis = axis.normalize();
		this.radians = radians;
	}
	public AxisAngle(float x, float y, float z, float radians) {
		this(new Vector3f(x, y, z), radians, false);
	}
	public AxisAngle(float x, float y, float z, float radians, boolean isNormalized) {
		this(new Vector3f(x, y, z), radians, isNormalized);
	}
	public final Quaternion toQuaternion() {
		Quaternion q = new Quaternion();
		q.fromAngleAxis(radians, axis);
		return q;
	}
	public Vector3f axis;
	public float radians;
}
